package cn.cdeden.knowledge.service;


import cn.cdeden.common.core.utils.page.TableDataInfo;
import cn.cdeden.knowledge.domain.Team;
import cn.cdeden.knowledge.domain.dto.ProRoleToTeamRole;
import cn.cdeden.knowledge.domain.dto.TeamDto;
import cn.cdeden.knowledge.domain.dto.TeamQueryParam;
import cn.cdeden.knowledge.domain.vo.TeamInformationVo;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.data.domain.Pageable;

import java.util.List;
import java.util.Set;

/**
* @author Chen
* @date 2022-09-05
*/
public interface TeamService extends IService<Team> {

    static final String CACHE_KEY = "team";

    /**
    * 查询数据分页
    * @param query 条件
    * @param pageable 分页参数
    * @return PageInfo<TeamDto>
    */
    TableDataInfo<TeamDto> queryAll(TeamQueryParam query, Pageable pageable);

    /**
    * 查询所有数据不分页
    * @param query 条件参数
    * @return List<TeamDto>
    */
    List<TeamDto> queryAll(TeamQueryParam query);

    TableDataInfo<TeamDto> queryByPerm(TeamQueryParam query,Pageable pageable);

    TeamDto createTeamByProject(TeamDto resources, List<ProRoleToTeamRole> managers, Long userInfoId);

    boolean teamRename(String name, Long userId);

    Team getById(Integer id);

    TeamInformationVo getInformation(Integer id);
    TeamDto findById(Integer id);

    /**
     * 插入一条新数据。
     */
    Team insert(TeamDto resources,boolean defaultRole);
    int updateById(TeamDto resources);
    int removeById(Integer id);
    int removeByIds(Set<Integer> ids);

    int ownerHandOver(TeamDto resources);

    TableDataInfo<TeamDto> queryByDelete(TeamQueryParam query, Pageable pageable);

    int recoverTeam(Integer teamId);

    /**
    * 导出数据
    * @param all 待导出的数据
    * @param response /
    * @throws IOException /
    */
    // void download(List<TeamDto> all, HttpServletResponse response) throws IOException;
}
